package com.cvte.vdt.uartservice.receiver;

import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;

import com.cvte.vdt.uartservice.util.LogUtil;

/**
 * Created by user on 2018/12/20.
 */
public class BootReceiver extends BroadcastReceiver{
    private static final String TAG = "BootReceiver";
    @Override
    public void onReceive(Context context, Intent intent) {
        String action = intent.getAction();
        if(action.equals(Intent.ACTION_BOOT_COMPLETED)){
            LogUtil.d(TAG,"get action Intent.ACTION_BOOT_COMPLETED");
            Intent serviceIntent = new Intent();
            serviceIntent.setAction("android.cvte.vdt.action.UARTSERVICE");
            ComponentName component = new ComponentName("com.cvte.vdt.vdtuartservice", "com.cvte.vdt.uartservice.VDTService");
            serviceIntent.setComponent(component);
            context.startService(serviceIntent);
        }
    }
}
